/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package EDT.obj;

/**
 *
 * @author ali
 */
public class Voeux {
    //1 pour le matin, 2 pour l'après midi et 3 pour dire toute la journée
    private int idCreneau;
    //de 1 à 5 (je le veux, oui , possibe , très difficile , pas possible
    private int poids;
    private String valide;
    private int priorite;
    private Utilisateur user;

   
    
    public Voeux(int idCreneau, int poids, String valide,int priorite,Utilisateur util) {
        this.idCreneau = idCreneau;
        this.poids = poids;
        this.valide = valide;
        this.user = util;
        this.priorite = priorite;
    }

    public int getIdCreneau() {
        return idCreneau;
    }

    public void setIdCreneau(int idCreneau) {
        this.idCreneau = idCreneau;
    }

    public int getPoids() {
        return poids;
    }

    public void setPoids(int poids) {
        this.poids = poids;
    }

    public String isValide() {
        return valide;
    }

    public void setValide(String valide) {
        this.valide = valide;
    }

     public int getPriorite() {
        return priorite;
    }

    public void setPriorite(int priorite) {
        this.priorite = priorite;
    }

    public Utilisateur getUser() {
        return user;
    }

    public void setUser(Utilisateur user) {
        this.user = user;
    }
    
    public String getBaliseCreneau(int idjour) {
        String ret;
        if(this.getIdCreneau()==3){
            
            ret = "<td><div class='calendrier-arial10 Voeux-Moment1'>"
                    + "Toute la journée</div>";
            if(this.isValide().equals("fals") ||getUser() instanceof Administrateur){
            ret += "<input type='radio' "
                    + "name='moment"+idjour+"' value='3' checked>"
                    + "Toute la journée<br>";
            ret += "<input type='radio' name='moment"+idjour+"' value='1'>Le matin<br>";
            ret += "<input type='radio' name='moment"+idjour+"' value='2'>Après midi";
            }
            ret +="</td>";
        
            
            
             
        }else{
            if(this.getIdCreneau()==1){
                
               ret = "<td><div class='calendrier-arial10 Voeux-Moment2'>";
               ret += "Le matin </div>";
               
               if(this.isValide().equals("fals") ||getUser() instanceof Administrateur){
               ret += "<input type='radio' name='moment";
               ret += idjour+"' value='3'>Toute la journée<br>";
               ret += "<input type='radio' name='moment"+idjour+"' value='1' checked>Le matin<br>";
               ret += "<input type='radio' name='moment"+idjour+"' value='2'>Après midi";
               }
               ret += "</td>";
              
               
            }else{
                ret = "<td><div class='calendrier-arial10 Voeux-Moment3'>";
                ret += "L'après midi </div>";
                if(this.isValide().equals("fals") ||getUser() instanceof Administrateur ){
                ret += "<input type='radio' name='moment";
                ret +=idjour+"' value='3'>Toute la journée<br><input ";
                ret += "type='radio' name='moment"+idjour+"' value='1' >";
                ret += "Le matin<br><input type='radio' name='moment"+idjour+"' ";
                ret += "value='2' checked>L'après midi";
                }
                ret += "</td>";
                
                
            }
            
        }
        ret += balisePoids(idjour);
        if(getUser() instanceof Administrateur){
        ret += balisePriorite(idjour);
        }
        
        return ret;
    }
    
    String balisePoids(int idjour){
        String ret="<td>";
        
        if(this.poids == 4){          
            ret += "<div class='calendrier-arial10 Voeux-poids"+this.poids+"'>"
                    + "Je le veux</div>";
            if(this.isValide().equals("fals")  || getUser() instanceof Administrateur){
                
            ret += "<input type='radio' name='poids"+idjour+"' value='4' checked>Je le veux<br>";
            ret += "<input type='radio' name='poids"+idjour+"' value='3'>Oui<br>";
            ret += "<input type='radio' name='poids"+idjour+"' value='2'>Possible<br>";
            ret += "<input type='radio' name='poids"+idjour+"' value='1'>Très difficile<br>";
            ret += "<input type='radio' name='poids"+idjour+"' value='0'>Pas possible";

            }
            
             
        }else{
            if(this.poids == 3){          
            ret += "<div class='calendrier-arial10 Voeux-poids"+this.poids+"'>"
                    + "Oui</div>";
            if(this.isValide().equals("fals")  || getUser() instanceof Administrateur){
                
            ret += "<input type='radio' name='poids"+idjour+"' value='4' >Je le veux<br>";
            ret += "<input type='radio' name='poids"+idjour+"' value='3' checked>Oui<br>";
            ret += "<input type='radio' name='poids"+idjour+"' value='2'>Possible<br>";
            ret += "<input type='radio' name='poids"+idjour+"' value='1'>Très difficile<br>";
            ret += "<input type='radio' name='poids"+idjour+"' value='0'>Pas possible";

            }
          
             
        }else{
                if(this.poids == 2){          
                ret += "<div class='calendrier-arial10 Voeux-poids"+this.poids+"'>"
                    + "Possible</div>";
                if(this.isValide().equals("fals")  || getUser() instanceof Administrateur){
                
                ret += "<input type='radio' name='poids"+idjour+"' value='4' >Je le veux<br>";
                ret += "<input type='radio' name='poids"+idjour+"' value='3' >Oui<br>";
                ret += "<input type='radio' name='poids"+idjour+"' value='2' checked>Possible<br>";
                ret += "<input type='radio' name='poids"+idjour+"' value='1'>Très difficile<br>";
                ret += "<input type='radio' name='poids"+idjour+"' value='0'>Pas possible";

                }
           
             
        }else{
                if(this.poids == 1){          
                ret += "<div class='calendrier-arial10 Voeux-poids"+this.poids+"'>"
                    + "Très difficile</div>";
                if(this.isValide().equals("fals")  || getUser() instanceof Administrateur){
                
                ret += "<input type='radio' name='poids"+idjour+"' value='4' >Je le veux<br>";
                ret += "<input type='radio' name='poids"+idjour+"' value='3' >Oui<br>";
                ret += "<input type='radio' name='poids"+idjour+"' value='2' >Possible<br>";
                ret += "<input type='radio' name='poids"+idjour+"' value='1' checked>Très difficile<br>";
                ret += "<input type='radio' name='poids"+idjour+"' value='0'>Pas possible";

                }
                
                
                
                } else{
                        
                    if(this.poids == 0){          
                    ret += "<div class='calendrier-arial10 Voeux-poids"+this.poids+"'>"
                    + "Pas possible</div>";
                    if(this.isValide().equals("fals")  || getUser() instanceof Administrateur){
                
                    ret += "<input type='radio' name='poids"+idjour+"' value='4' >Je le veux<br>";
                    ret += "<input type='radio' name='poids"+idjour+"' value='3' >Oui<br>";
                    ret += "<input type='radio' name='poids"+idjour+"' value='2' >Possible<br>";
                    ret += "<input type='radio' name='poids"+idjour+"' value='1' >Très difficile<br>";
                    ret += "<input type='radio' name='poids"+idjour+"' value='0' checked>Pas possible";

                    }

                }
                    
                    
                }
                
                }
                
            }
        }
        
        
        ret += "</td>";
        return ret;
    }
    
    String balisePriorite(int idjour){
        String ret = "<td>";
        ret += "<div  class='calendrier-arial10 Priorite'>"+getPriorite()+"</div>";
        ret += "<select name='priorite"+idjour+"'>";
        for(int i=0;i<= 10; i++){
            if (i==getPriorite()){
                ret  +="<option value='"+i+"' selected>"+i+"</option>";
            }else{
                ret  +="<option value='"+i+"'>"+i+"</option>";
            }
        }
        ret += "</select>";
        ret += "</td>";
        return ret;
    }


}
